<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
	<head>
		<meta charset="UTF-8">
		<title>Title</title>
		<link rel="stylesheet" href="../../../component/pear/css/pear.css" />
	</head>
	<body>
		<form class="layui-form" action="">
			<div class="mainBox">
				<div class="main-container">
					<div class="main-container">
						<div class="layui-form-item">
							<label class="layui-form-label">分类</label>
							<div class="layui-input-block">
								 <select name="stype" lay-verify="stype"> 
								 	<option value="1">口齿不清</option>
								 	<option value="2">面瘫</option>
								 	<option value="3">脑瘫</option>
									<option value="4">走路不稳</option>
								 </select>
							</div>
						</div>
						 
						  
					</div>
				</div>
			</div>
			<div class="bottom">
				<div class="button-container">
					<button type="submit" class="pear-btn pear-btn-primary pear-btn-sm" lay-submit=""
						lay-filter="user-save">
						<i class="layui-icon layui-icon-ok"></i>
						提交
					</button>
					<button type="reset" class="pear-btn pear-btn-sm">
						<i class="layui-icon layui-icon-refresh"></i>
						重置
					</button>
				</div>
			</div>
		</form>
		<script src="../../../component/layui/layui.js"></script>
		<script src="../../../component/pear/pear.js"></script>
		<script>
			layui.use(['form', 'jquery', 'laydate'], function() {
				var BASE_URL="/shengyin/";
				
				
				let form = layui.form;
				let $ = layui.jquery;
				 
				
				// form.verify({
				// 	sname: [/^[\u4e00-\u9fa5]{2,10}$/, "请输入2到10个汉字！"],
				// 	telephone: [/^1[3-9]\d{9}$/, "请输入中国的手机号"] 
				// });
				form.on('submit(user-save)', function(data) { 
					  
					$.ajax({
						url:BASE_URL+"survey/generate/"+data.field.stype,
						//data:JSON.stringify(data.field),
						type:"get",
						dataType:'json',
						contentType:'application/json',
						success:function(result){
							if(result.code==0){
							    layer.msg(result.msg,{icon:1,time:1000},function(){
							        parent.layer.close(parent.layer.getFrameIndex(window.name));//关闭当前页
							        parent.layui.table.reload("user-table");
							    });
							}else{ 
							    layer.msg(result.msg,{icon:2,time:2000});
							}
						},
						error:function(e){
							layer.msg(e,{icon:2,time:2000});
						}
					});
					
					// $.post(BASE_URL+"suser/add",data.field,function(result){
					// 	//alert(JSON.stringify(result));
					// 	if(result.code==0){
					// 	    layer.msg(result.msg,{icon:1,time:1000},function(){
					// 	        parent.layer.close(parent.layer.getFrameIndex(window.name));//关闭当前页
					// 	        parent.layui.table.reload("user-table");
					// 	    });
					// 	}else{ 
					// 	    layer.msg(result.msg,{icon:2,time:2000});
					// 	}
					// }).error(function(e){
					// 	layer.msg(e,{icon:2,time:2000});
					// });
					return false;
				});
			})
		</script>
		<script>
		</script>
	</body>
</html>
